/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb;

import entities.Thema;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Dennis Wittkoetter <dennis.wittkoetter@hs-osnabrueck.de>
 */
@Stateless
public class Verwaltung {
    @PersistenceContext(unitName = "JSFForumEJBPU") 
    private EntityManager em;
    
    public void persist(Object object) { 
        em.persist(object);
    }
    
    public void merge(Object object) { 
        em.merge(object);
    }
    
    public List<Thema> getThemen() {
        Query query = em.createQuery("SELECT t FROM Thema t");
        return (List<Thema>)query.getResultList();
    }
}

